'''
* This is the projet for Brtc LlmOps Platform
* @Author Leon-liao <liaosiliang@alltman.com>
* @Description //TODO 
* @File: auth_schema.py
* @Time: 2025/10/11
* @All Rights Reserve By Brtc
'''
from flask_wtf import FlaskForm
from marshmallow import Schema, fields
from wtforms import StringField
from wtforms.validators import DataRequired, Email, Length, regexp

from pkg.password.password import password_pattern


class PasswordLoginReq(FlaskForm):
    """账号密码登录请求结构"""
    email = StringField("email", validators=[
        DataRequired("登录邮箱不能为空！"),
        Email("登录邮箱格式错误"),
        Length(min = 5, max = 254, message="登录邮箱长度应该再5-254个字符！")
    ])

    password = StringField("password", validators=[
        DataRequired("修改密码不能为空！"),
        regexp(regex=password_pattern, message="密码最少包含一个字母,一个数字，并且长度是8-16位！！")
    ])


class PasswordLoginResp(Schema):
    """账号密码授权认证响应结构"""
    access_token = fields.String()
    expire_at = fields.Integer()